#ifndef _LOG_SYSTEM_H_
#define _LOG_SYSTEM_H_

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \mainpage Log System.
/// 		  
/// \tableofcontents
/// \section intro_sec Introduction
/// 		 Log system is a simple log system, written in C++. It is build on the basis of simplicity to setup 
/// 		 and use, also trying to be fast and reliable.
/// \section configuration_sec Configuration
/// 		 The only one dependency of the Log library is boost. You don't need any other library installed. 
/// 		 The boost library must be installed and globally visible into your development environment.
/// \section initializing_sec Initializing Log
/// 		 The first thing you need is to initialize the log as a singleton.
/// 		 \code{.cpp}
/// 		 glog::CGlobalLog::initSingleton();
/// 		 \endcode
/// 		 Then you may want to get the reference of the log into a var
/// 		 \code{.cpp}
/// 		 glog::CGlobalLog* _log = &glog::CGlobalLog::getSingleton();
/// 		 \endcode
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "WriterCatalog.h"
#include "GlobalLog.h"
#include "core/core_utils.h"

#define THROW_AND_LOG(APPENDER, TYPE, MESSAGE) \
	glog::__throw_and_log<TYPE>(__FILE__, __LINE__,APPENDER, MESSAGE, #TYPE)

namespace glog{
	template<typename T>
	void __throw_and_log(std::string file, unsigned int line,std::string appender, std::string message, std::string type)
	{
		CGlobalLog::getSingleton().ERROR_MSG(appender,"%s: %d Exception of type %s. Description:\n\t%s",file.c_str(), line, type.c_str(), message.c_str() );
		z3d::core::launchException<T>(file, line, message);
		CGlobalLog::getSingleton().processMessages();
		throw;
	}
}

#endif //_LOG_SYSTEM_H_
